export default function (VueRouter, routes, options = {}) {
    var router = new VueRouter(Object.assign({
        routes: routes
    }, options.router));
    
    // 拦截路由 不存在的路由将不会跳转
    router.beforeEach((to, from, next) => {        
        // vue router matched is a matched routes array
        if (to && to.matched && Array.isArray(to.matched) && to.matched.length > 0) {
            next();
        } else {
            // router is not found
            console.log("router is not found [call from router]");
            next(false);
        }
    }); 

    return router;
}